package com.lizemin.controller;

import com.lizemin.entity.Ip;
import com.lizemin.mapper.IpMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author lzm
 * @date 2025/3/23 10:50
 * @description
 */
@RestController
public class TestController {

    @Autowired
    private IpMapper ipMapper;

    @GetMapping("/heartbeat")
    public String heartbeat(){
        return "ok";
    }

    @GetMapping("/getIpList")
    public List<String> getIpList(){
        List<Ip> ips = ipMapper.selectList(null);
        return ips.stream().map(Ip::getIp).collect(Collectors.toList());
    }

}
